# encoding:utf-8

from decimal import Decimal

from pojo.entity.BaseEntity import BaseEntity


class CurrentStockItem(BaseEntity):
    tradeDate = None
    strategyId = None
    symbol = None
    exchange = None
    setype = None
    market = None
    recommendPos = None
    lastRecommendPos = None

    def newInstance(self, tradeDate, strategyId, symbol, exchange, setype, recommendPos, lastRecommendPos):
        self.tradeDate = tradeDate
        self.strategyId = strategyId
        self.symbol = symbol
        self.exchange = exchange
        self.setype = setype
        self.recommendPos = recommendPos
        self.lastRecommendPos = lastRecommendPos
        return self

    def changeFormat(self):
        self.recommendPos = Decimal(self.recommendPos)
        return self

    def getTableName(self):
        pass

    def getTableFieldMap(self):
        pass

    def __str__(self):
        descDict = self.__dict__
        return """CurrentStockItem-----{desc}""".format(
            desc=",".join(
                ["{key}:{val}".format(key=key, val=val.encode("utf-8") if isinstance(val, unicode) else val) for
                 key, val in descDict.items()])
        )
